home *** CD-ROM | disk | FTP | other *** search
/ Resource Library: Multimedia / Resource Library: Multimedia.iso / hypercrd / xcmds / shwdlg16.hqx / ShowDialog XCMD 1.6 / card_17020.txt < prev    next >
Text File  |  1989-05-10  |  5KB  |  124 lines

  1. -- card: 17020 from stack: in.6
  2. -- bmap block id: 0
  3. -- flags: 0000
  4. -- background id: 3411
  5. -- name: Type 1 XCMD
  6.  
  7.  
  8. -- part 1 (button)
  9. -- low flags: 80
  10. -- high flags: A003
  11. -- rect: left=298 top=120 right=142 bottom=415
  12. -- title width / last selected line: 0
  13. -- icon id / first selected line: 0 / 0
  14. -- text alignment: 1
  15. -- font id: 0
  16. -- text size: 12
  17. -- style flags: 0
  18. -- line height: 16
  19. -- part name: Dialog Type
  20. ----- HyperTalk script -----
  21. on mouseUp
  22.   put "Do you want to export your data to a text file before quitting HyperCard?" into promptStr
  23.   ShowDialog 1,3758,promptStr,TRUE
  24.   if the result = 1 then
  25.     put "You clicked on the ΓÇ£YESΓÇ¥ button!" into bg fld "theResult"
  26.   else if the result = 2 then
  27.     put "You clicked on the ΓÇ£CANCELΓÇ¥ button!" into bg fld "theResult"
  28.   else if the result = 3 then
  29.     put "You clicked on the ΓÇ£NOΓÇ¥ button!" into bg fld "theResult"
  30.   end if
  31. end mouseUp
  32.  
  33.  
  34.  
  35. -- part 2 (button)
  36. -- low flags: 80
  37. -- high flags: A003
  38. -- rect: left=300 top=180 right=202 bottom=417
  39. -- title width / last selected line: 0
  40. -- icon id / first selected line: 0 / 0
  41. -- text alignment: 1
  42. -- font id: 0
  43. -- text size: 12
  44. -- style flags: 0
  45. -- line height: 16
  46. -- part name: Alert Type
  47. ----- HyperTalk script -----
  48. on mouseUp
  49.   beep 1
  50.   ShowDialog 1,3757,"Do you really want to delete all cards in this stack?",TRUE
  51.   if the result = 1 then
  52.     put "You clicked on the ΓÇ£OKΓÇ¥ button!" into bg fld "theResult"
  53.   else put "You clicked on the ΓÇ£CANCELΓÇ¥ button!" into bg fld "theResult"
  54. end mouseUp
  55.  
  56.  
  57.  
  58. -- part 4 (button)
  59. -- low flags: 00
  60. -- high flags: 0000
  61. -- rect: left=11 top=4 right=64 bottom=78
  62. -- title width / last selected line: 0
  63. -- icon id / first selected line: 529 / 529
  64. -- text alignment: 1
  65. -- font id: 0
  66. -- text size: 12
  67. -- style flags: 0
  68. -- line height: 16
  69. -- part name: SD
  70.  
  71.  
  72. -- part contents for background part 21
  73. ----- text -----
  74. ShowDialog XCMD Type 1
  75.  
  76. -- part contents for background part 15
  77. ----- text -----
  78. ShowDialog Type 1 parameters are:
  79.  
  80. ShowDialog 1,<DLOG resource ID>,<prompt string>,
  81. <default button BOOLEAN>[,<top coord>,<left coord>]
  82.  
  83. where 1 is the type of the external;
  84. <DLOG resource ID> is the resource ID of the DLOG template;
  85. <prompt string> consists of the dialog's text string;
  86. <default buttom BOOLEAN> describes whether a button is to be outlined with black and thus be the default button.  (The default button can be selected by typing RETURN or ENTER in addition to clicking on it).  This parameter must be either TRUE or FALSE;
  87.  
  88. The last two parameters are OPTIONAL. They are:
  89. <top coord>  and <left coord> are used to set the top,left coordinates for placing the dialog.  If these two parameters are omitted, the dialog will be centered within the card window. 
  90.  
  91.  
  92.  
  93. -- part contents for background part 17
  94. ----- text -----
  95. Creating the resources for ShowDialog XCMD Type 1:
  96.  
  97. The requirements for creating DLOG templates for Type 1 of ShowDialog XCMD with ResEdit are:
  98. For "standard" dialogs and alerts the procID should be 1 (this describes how the dialog will "look"), the visible and goAwayFlag boxes must be unchecked, and the DLOG and associated DITL resources should be made purgeable.
  99.  
  100. If you are going to have a default button, it MUST be DITL item #1.  This is because the first item in the item list is always assumed to be the default button.  The Macintosh Toolbox will interpret a press of the Return or Enter key as equivalent to a mouse click in the default button.
  101.  
  102. In your DITL template your field (of type Static Text) that will contain the prompt string must contain the placeholder "^0" (don't use the quotes; and that's a zero).  Your text will be substituted here.
  103.  
  104. All items in the item list EXCEPT the buttons must be DISABLED.
  105.  
  106. For alert boxes, you should precede your call to the external with "beep 1."  It is a Macintosh convention that alerts beep when they are displayed on the screen.
  107.  
  108. The item number clicked on will be returned in "the result".  This is only true for ENABLED item numbers.
  109.  
  110.  
  111.  
  112. -- part contents for background part 30
  113. ----- text -----
  114. 13
  115.  
  116. -- part contents for background part 18
  117. ----- text -----
  118. Type 1 of ShowDialog XCMD is used to create "standard" dialog and alert boxes that contain static text, icons, PICTs, and as many "regular" buttons as you want.  
  119.  
  120. You can modify the static text field on the fly by specifying a text string in the parameter list.
  121.  
  122. You decide whether or not to have a default (outlined) button.
  123.  
  124. You can specify where on the screen to place the dialog, or you can allow it to automatically center itself within the card window.